servlet |
您所在的位置:网站首页 › jar not load › servlet |
Deployed a “war” file on Tomcat, and hits following error messages : Jul 17, 2014 7:59:55 PM org.apache.catalina.loader.WebappClassLoader validateJarFile INFO: validateJarFile(D:\apache-tomcat-7.0.53\webapps\hc\WEB-INF\lib\servlet-api-2.5.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class Tools used : JDK1.7 Maven 3 Tomcat 7 Reason The Tomcat’s container comes with own version of servlet-api.jar, and the “war” file is deploy the same jar again, and causing the Offending class: javax/servlet/Servlet.class.This is a really common problem for developers who are using Maven as a build tool. Normally, we will include the servlet-api as a project dependency like this : pom.xml javax.servlet servlet-api 2.5When building a war file, Maven will include the servlet-api as well. Solution To fix it, set the scope to provided. This tells Maven use code servlet-api.jar for compiling and testing only, but NOT include it in the WAR file. The deployed container will “provide” the servlet-api.jar at runtime. pom.xml javax.servlet servlet-api 2.5 providedReferences Maven : Introduction to the Dependency Mechanism 转自:http://www.mkyong.com/java/servlet-api-2-5-jar-jar-not-loaded/ 相关:http://stackoverflow.com/questions/1993493/error-servlet-jar-not-loaded-offending-class-javax-servlet-servlet-class http://yunzhu.iteye.com/blog/1015416 自己的理解: WEB-INFO/lib中的jar与Tomcat/lib中的service-api.jar冲突了,Tomcat启动后,只会用他自己的jar,所以自己配置的jar要删掉 |
今日新闻 |
点击排行 |
|
推荐新闻 |
图片新闻 |
|
专题文章 |
CopyRight 2018-2019 实验室设备网 版权所有 win10的实时保护怎么永久关闭 |